package com.nyp.remoter.web;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.event.AjaxBehaviorEvent;
import javax.inject.Named;

import com.nyp.remoter.ejb.PetHandlerEJB;

@Named
@SessionScoped
public class PetJsfBean implements Serializable{
	
	private static final long serialVersionUID = 8049652144078326086L;

	private @EJB PetHandlerEJB petHandler;
	
	private int ownerNumber;
	private int fightNumber;
	private String status;
	
	public String generateOwner(AjaxBehaviorEvent evt){
		if(ownerNumber != 0){
			petHandler.createRandomOwners(ownerNumber);
		}
		else{
			petHandler.createRandomOwner();
		}
		status = "Succesfully created " + ownerNumber + " owners";
		return null;
	}
	
	public String generateFight(AjaxBehaviorEvent evt){
		petHandler.createRandomFights(fightNumber);
		status = "Succesfully created " + fightNumber + " fights";
		return null;
	}

	public int getOwnerNumber() {
		return ownerNumber;
	}

	public void setOwnerNumber(int ownerNumber) {
		this.ownerNumber = ownerNumber;
	}

	public int getFightNumber() {
		return fightNumber;
	}

	public void setFightNumber(int fightNumber) {
		this.fightNumber = fightNumber;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}
